# -*- coding: utf-8 -*-
"""
@Time : 2023/6/11 19:21
@Author : Gremore
@File : request_model
@Des: 
"""
from tsim.commons.requests.request_model import BaseBody, ToolsSchemas
from pydantic import validator, Field

class CreatePlanBody(BaseBody):
    title: str = Field(..., title="标题", description="必传")
    description: str = Field(..., title="描述", description="必传")

    @validator('title')
    def check_field(cls, v):
        return ToolsSchemas.not_empty(v)

class UpdatePlanBody(BaseBody):
    id: int
    title: str = Field(..., title="标题", description="必传")
    description: str = Field(..., title="描述", description="必传")
    # type: str
    # tags: str
    # status: str
    # priority: int

    @validator('title')
    def check_field(cls, v):
        return ToolsSchemas.not_empty(v)


class DeletePlanBody(BaseBody):
    id: int



# ====================
class CalendarBody(BaseBody):
    start_time: int
    end_time: int

class CreateCalendarBody(CalendarBody):
    title: str = Field(..., title="标题", description="必传")
    @validator('title')
    def check_field(cls, v):
        return ToolsSchemas.not_empty(v)


class UpdateCalendarBody(CalendarBody):
    id: int
    title: str = Field(..., title="标题", description="必传")


    @validator('id')
    def check_field(cls, v):
        return ToolsSchemas.not_empty(v)


class DeleteCalendarBody(BaseBody):
    id: int
